<script src="../../resources/js-test.js"></script>
<iframe id=testIframe></iframe>
<script>
description('Detaching a frame in beforeunload event handler should not crash.');
testIframe.contentWindow.onbeforeunload = function(event) {
    testIframe.parentNode.removeChild(testIframe);
    event.returnValue = 'beforeunload';
}
testPassed('if no crash');
testIframe.contentWindow.location.href = "resources/does-not-exist.html";
</script>
